package com.bwie.config;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Auther:${涛}
 * @Date:2024/8/30 20:29
 * @Description: Rabbmq
 * @Version 1.0.0
 */
@Component
public class RabbitMq {


    @Autowired
    private RabbitTemplate rabbitTemplate;


    public void seRabbitMq() {
        rabbitTemplate.setConfirmCallback(new RabbitTemplate.ConfirmCallback() {
            @Override
            public void confirm(CorrelationData correlationData, boolean b, String s) {
                if(b) {
                    System.out.println("消费成功");
                }else{
                    System.out.println("消费失败");
                }
            }
        });
    }
}


